﻿using System.Collections;
using System.Collections.Generic;
using BearUtil;
using BearUtil.Hidden;
using UnityEngine;

namespace BearUtil
{
    [CustomNodeGraphEditor(typeof(StoryGraph))]
    public class StoryWindow : XNodeEditor.NodeGraphEditor
    {
        private StoryGraph graph;

        public override void OnGUI()
        {
            base.OnGUI();

            if (window && graph.LastFocusPosition != window.panOffset)
            {
                // Debug.Log("Test ------");
                graph.LastFocusPosition = window.panOffset;
            }
        }

        public override void OnOpen()
        {
            base.OnOpen();
            graph = target as StoryGraph;
            var pos = graph.LastFocusPosition;
            window.panOffset = pos;
            window.titleContent = new GUIContent(graph.name);
            graph.UpdateData();
        }
    }
}